package myrichint


class MyRichInt {
  println("MyRichInt 初始化")

  def to(end: Int): Unit = {
    println("MyRichInt:调用to方法")
  }
}
class MyInt {
  println("MyInt 初始化")
}

object MyPredef {
  implicit  def MyIntToMyRichInt(myint: MyInt): MyRichInt = {
    new MyRichInt()
  }
}
object MyRichIntDemo {
  def main(args: Array[String]): Unit = {
    val myInt = new MyInt()
    import  MyPredef.MyIntToMyRichInt
    myInt.to(20)
  }
}
